//评论有关接口

import axios from "axios";
import { ElMessage } from "element-plus";
import { ref } from "vue";
import { getCurrentInstance } from "vue";

export async function addBookShelfAPI(book_id,proxy) {
  const formData = new FormData();
  formData.append("book_id", book_id);
  try {
    const response = await proxy.$http.post(
      "/api/book/add-bookshelf",
      formData,
      {
        headers: {
          "Content-Type": "multipart/form-data",
        },
      }
    );
    console.log(response.data);
  } catch (error) {
    console.error(`Error fetching ${id} chapter:`, error);
    return [];
  }
}
export async function removeBookShelfAPI(book_id, proxy) {
  const formData = new FormData();
  formData.append("book_id", book_id);
  try {
    const response = await proxy.$http.post("/api/book/remove-bookshelf",formData, {
      headers: {
          "Content-Type": "multipart/form-data",
        },
    });
    console.log(response.data);
  } catch (error) {
    console.error(`Error fetching ${id} chapter:`, error);
    return [];
  }
}